package com.ljx.blog.user.service.impl;

import com.ljx.blog.user.enums.TenantRoleEnum;
import com.ljx.blog.security.common.UserContext;
import com.ljx.blog.security.util.UserUtil;
import com.ljx.blog.user.domain.entity.Tenant;
import com.ljx.blog.user.domain.vo.resp.AdminOptionsResp;
import com.ljx.blog.user.service.AdminService;
import com.ljx.blog.user.service.RoleService;
import com.ljx.blog.user.service.TenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-10-20  14:42
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private RoleService roleService;

    @Autowired
    private TenantService tenantService;

    @Override
    public AdminOptionsResp getOpts() {
        Boolean isAdminUser = UserUtil.checkIsTenantAdmin();
        Boolean isPlatform = UserUtil.checkIsPlatform();
        AdminOptionsResp adminOptionsResp = new AdminOptionsResp();
        adminOptionsResp.setOpBlogAble(isAdminUser);
        adminOptionsResp.setOpUserAble(isAdminUser);
        adminOptionsResp.setOpRoleAble(isPlatform);
        adminOptionsResp.setOpArticleAble(isAdminUser);
        adminOptionsResp.setOpTenantAble(isPlatform);

        return adminOptionsResp;
    }
}
